Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: xdebug unable to connect to host when running wp-env in windows … #31192

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

frankdannhauer
Copy link

…wsl2

Description

How has this been tested?

Open WSL2 bash

git clone https://github.com/frankdannhauer/gutenberg.git
cd gutenberg
npm install
npm run build
npm run lint-js
packages/env/bin/wp-env start --xdebug

Set breakpoint in VS Code at line 16 in gutenberg.php

Execution does stop at set breakpoint.

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Apr 26, 2021
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @frankdannhauer! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@mkaz
Copy link
Member

mkaz commented Oct 13, 2021

I'm not quite able to get the setup to work. The update you have looks right but I'm unable to confirm to approve.

What environment are you running? Are you running Docker with a WSL2 backend? Are you Docker on WSL2? Or are you using remote containers in WSL2 back to the Windows desktop?

There are quite a bit different setups possible, I tried running with Docker backed by WSL2 backend but was not able to confirm.

Also, are there any specific extensions you are using in VS Code? I have the PHP Debug installed for breakpoints but does not seem to connect to the Docker environment.

@frankdannhauer
Copy link
Author

frankdannhauer commented Oct 14, 2021

Thanks for your reply mkaz.

What environment are you running? Are you running Docker with a WSL2 backend? Are you Docker on WSL2? Or are you using remote containers in WSL2 back to the Windows desktop?

I'm using Docker Desktop with the WSL 2 based engine and have WSL Integration enabled (Resources->WSL Integration) for my WSL 2 Instances.

The assigned Docker Subnet (Resources->Network) is 192.168.65.0/28

Visual Studio Code is running on Windows using the \\wsl$ share mounted as a volume with PHP Debug as debugger. The debugger is listening on all interfaces visible to the Windows host on port 9003

wp-env is then started from a terminal in my WSL 2 instance.

Since the loopback interface inside the wp-env docker seems to be isolated from the interfaces on the Windows host, the discovered client host (localhost) is not reachable from inside the docker container and xdebug is not able to connect to port 9003 on the host.

There are quite a bit different setups possible, I tried running with Docker backed by WSL2 backend but was not able to confirm.

Maybe mine is a weird setup - I don't know...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Tool] Env /packages/env
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants